const { User } = require('../utils/db')

const { sign, verify, hash, compare } = require('../utils/tools')

const findOne = (username) => {
    return User.findOne({'username': username})
}

const signup = async (username, password) => {
    password = await hash(password)
    const user = new User({username: username, password: password})
    return user.save()
}

module.exports = {
    findOne,
    signup,
}